<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page import="java.util.List"%>
<%@ page import="com.application.model.entity.Model"%>
<%@ page import="com.application.role.entity.Role"%>
<%@ page import="com.application.usertable.entity.Usertable"%>
<%@ page import="com.util.ApplicationUtil"%>
<%@ page import="org.springframework.web.context.WebApplicationContext"%>
<%
	String path = request.getContextPath();
	ServletContext sc = request.getSession().getServletContext();
	ApplicationUtil au = new ApplicationUtil();
	Usertable utable = (Usertable)session.getAttribute("loginUser");
	String usertype = "";
	List<Model> mList = au.getModelListByFid("0",utable.getId());
	List<Role>  role = utable.getRoleList();
	for(int i=0;i<role.size();i++){
		if(role.get(i).getName().equals("系统管理员")){
			usertype = "system";
		}
	}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>顶部页面</title>
<script src="<%=path%>/js/leftmenu.js" language="javascript" type="text/javascript"></script>
<script src="<%=path%>/js/util.js" language="javascript" type="text/javascript"></script>
<link href="<%=path%>/css/jinmu_style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
function changeState() {
	var content=top.document.getElementById("content"); //alert(content);
	var img=$("leftIcon"),menuword=$("menuword");
	if(content.cols!="0,*")
	{
		content.cols = "0,*";
		img.src = "<%=path%>/images/frame_menu/icon_17.gif";
		menuword.innerText="显示目录"; 
	}
	else
	{
		content.cols = "198,*";//
		img.src = "<%=path%>/images/frame_menu/icon_18.gif";
		menuword.innerText="隐藏目录";
	}
}

function checkMenuShow(){
	var content=top.document.getElementById("content"); 
	var img=$("leftIcon"),menuword=$("menuword");
	if(content.cols=="0,*")
	{
		content.cols = "20%,*";
		img.src = "<%=path%>/images/frame_menu/icon_18.gif";
		menuword.innerText="隐藏目录";
	}
}

function changeMenu(targetElement,mainFrameLocation)
{
	objTd.className="";
	targetElement.className ="bai_kuang";
	objTd=targetElement;
	parent.mainFrame.location = mainFrameLocation;
}

function reloadPage(){
	parent.mainFrame.location = 'page/content.html';
}

function topFixWidth(){
   var tb=$("controlWidthTb");
   var oldtoptbwidth=tb.scrollWidth;
   if(document.body.scrollWidth<=980){ tb.style.width=980; }else{ tb.style.width="100%" }
}
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bannerbg">
  <tr>
    <td class="topright"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="40%" align="left"><img src="<%=path%>/images/topbg1.jpg" width="380" height="60"></td>
        <td width="60%" align="right" valign="top" class="pad5"><table border="0" cellpadding="0" cellspacing="5" class="baizi">
          <tr>
            <td><img src="<%=path%>/images/img-9.gif" width="12" height="12"></td>
            <td class="text_bice" width="30" ><a href="#" onClick="back();">后退</a></td>
            <td><img src="<%=path%>/images/img-10.gif" width="12" height="12"></td>
            <td class="text_bice" width="30" ><a href="#" onClick="forward();">前进</a></td>
            <td><img src="<%=path%>/images/renovate.gif" width="16" height="16"></td>
            <td class="text_bice" width="30" ><a href="#" onClick="refresh();">刷新</a></td>
            <td><img src="<%=path%>/images/home.gif" alt="主页" width="12" height="13"></td>
            <td class="text_bice" width="30" ><a href="#" onClick="showIndex();">主页</a></td>
            <td><img src="<%=path%>/images/quit.gif" alt="注销" width="16" height="16"></td>
            <td class="text_bice" width="30" ><a href="#"  onClick="logonout();">注销</a></td>
            <td><img src="<%=path%>/images/114.gif" alt="修改密码" width="14" height="14"></td>
            <td class="text_bice" width="54" ><a href="#" onClick="modifyPassWord();">修改密码</a></td>
                        <td><img src="<%=path%>/images/svn.gif" alt="SVN系统" width="14" height="14"></td>
            <td class="text_bice" width="50" ><a href="http://www.baidu.com"  target="_blank">SVN系统</a></td>
                        <td><img src="<%=path%>/images/bbs.gif" alt="BBS系统" width="14" height="14"></td>
            <td class="text_bice" width="50" ><a href="http://localhost/BBS"  target="_blank">BBS系统</a></td>
          </tr>
        </table></td>
      </tr>
    </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="24%" class="shutop lan13b"><img src="<%=path%>/images/icon_18.gif" width="11" height="11">&nbsp;<a href="#" onClick="changeState();">隐藏目录</a></td>
            <td width="48%" align="left" valign="top">
            <table width="99%" border="0" cellspacing="0" cellpadding="0" class="bai13bold">
                <tr>
                <td id="menuTd0"  align="center" onClick="changeMenu(this,'left.jsp?mid=123412345')" style="cursor:hand">我的工作台</td>
               <% 
               if(request.getParameter("ly")==null){
               		out.println("<script>parent.mainFrame.location = 'left.jsp?mid=123412345'</script>");
               }
               if(mList!=null){ 
               	for(int i=0;i<mList.size();i++){
               		Model m = mList.get(i);
               		if(i==0){
               			//out.println("<script>parent.mainFrame.location = 'left.jsp?mid="+m.getId()+"'</script>");
               		}
               %>
                      <td id="menuTd<%=i%>"   align="center" onClick="changeMenu(this,'left.jsp?mid=<%=m.getId()%>')" style="cursor:hand"><%=m.getName()%></td>
                      
				<%}
				}
				if(usertype.equals("system")){
				
				%>
				<td id="menuTd16"   align="center" onClick="changeMenu(this,'left.jsp?mid=12341234')" style="cursor:hand">系统管理</td>
				
					<%}%>
                </tr>
              </table>
            </td>
            <td width="32%" align="right" class="padr10 baizi"><img src="<%=path%>/images/node_user.gif">&nbsp;机构：<%=utable.getOrg()%>&nbsp;&nbsp;当前用户：<%=utable.getRname() %></td>
          </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
<script>
//退出
function logonout(){
 if (confirm("用户即将退出，确定后退出该页面！")){
   	parent.location = 'loginOut.jsp';
   }
}

//修改密码
function modifyPassWord(){
	parent.rhs.location = '<%=path%>/application/system/changePassword.jsp';
}

//首页
function showIndex(){
    //changeState();
	parent.mainFrame.location="<%=path %>/left.jsp?ly=homePage&mid=123412345";
	parent.main.location = '<%=path %>/enterWorkBench.do?method=enterWorkBench';
}

//前进
function forward(){
    parent.main.history.go(1);
}

//后退
function back(){
     parent.main.history.go(-1);
}

//刷新
function refresh(){
    parent.main.location.reload();
}

//帮助
function help(){
    var url = "<%=path %>/listHelp.do?method=getSystemHelpList";
    //openModalDialog(url,null,['100px','620px',,,'help:0;scroll:0;resizable:0;status:0;unadorned:1;scrollbars:0']);
    window.showModalDialog(url,'','dialogWidth=800px;dialogHeight=700px;dialogLeft=50px;dialogTop=150px;directories:no; localtion:no; menubar:no; status=no;toolbar=no;scrollbars:yes;Resizeable=no;scroll:yes'); 
}

var objTd =document.getElementById("menuTd0");
objTd.className= "bai_kuang";
</script>

